# Maintainer: Kyle Keen <keenerd@gmail.com>
# Contributor: Will Shanks <wsha dot code at g mail dot com>

pkgname=python-terminado
_pkgname=terminado
pkgver=0.17.1
pkgrel=3
pkgdesc="Terminals served to term.js using Tornado websockets"
url="https://github.com/takluyver/terminado"
arch=('any')
license=('BSD')
depends=('python-tornado' 'python-ptyprocess')
makedepends=('python-build' 'python-installer' 'python-hatchling')
checkdepends=('python-pytest')
source=("https://files.pythonhosted.org/packages/source/t/terminado/terminado-$pkgver.tar.gz")
sha256sums=('6ccbbcd3a4f8a25a5ec04991f39a0b8db52dfcd487ea0e578d977e6752380333')

build() {
  cd $_pkgname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_pkgname-$pkgver

# Workaround for readline 8.1
  echo "set enable-bracketed-paste off" > .inputrc
  INPUTRC=$PWD/.inputrc \
  pytest -v
}

package() {
  cd "$srcdir/$_pkgname-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/python-$_pkgname/LICENSE"
}
